#ifndef CONNECTIONPOOL_H
#define CONNECTIONPOOL_H
#include <QtSql>
#include <QMutex>


struct ConnInfo_Db
{
	QString serverName;  // ip
	QString port;        // 端口
	QString userName;    // 用户名
	QString password;    // 密码
	QString dbName;      // 数据库名
};

class ConnectionPool 
{
public:
    static void initInfo(const ConnInfo_Db& db_conninfo);
    static QSqlDatabase openConnection();                        
    static void closeConnection(QSqlDatabase connection); 

public:
    static ConnInfo_Db s_db_conninfo;

private:
    static QMutex m_mutex;
    static quint64 key;
};

#endif // CONNECTIONPOOL_H
